// lib/data.ts
export const items = [
    {
        id: 'element-001',
        name: '用户管理按钮',
        type: 'Button',
        module: '用户管理',
        description: '用于跳转用户列表页面的按钮',
        status: 'active',
        createTime: '2024-05-12 10:20:00',
        updateTime: '2024-06-01 14:30:00',
        permissions: ['user:view'],
        metadata: {
            icon: 'user',
            color: '#409EFF',
            position: 'top-right',
            visible: true,
        },
        stateData: [
            { name: '周一', value: 4200, percentage: 68 },
            { name: '周二', value: 3800, percentage: 72 },
            { name: '周三', value: 5100, percentage: 65 },
            { name: '周四', value: 4900, percentage: 75 },
            { name: '周五', value: 6300, percentage: 82 },
            { name: '周六', value: 8500, percentage: 78 },
            { name: '周日', value: 7200, percentage: 85 },
        ]
    },
    {
        id: 'element-002',
        name: '系统设置表单',
        type: 'Form',
        module: '系统设置',
        description: '编辑系统参数的表单区域',
        status: 'inactive',
        createTime: '2024-03-21 08:15:00',
        updateTime: '2024-04-10 11:40:00',
        permissions: ['system:edit'],
        metadata: {
            fields: ['siteName', 'maxUploadSize', 'enableFeatureX'],
            autosave: true,
            validation: true,
        },
    },
    {
        id: 'element-003',
        name: '服务器监控图表',
        type: 'Chart',
        module: '运维中心',
        description: '展示 CPU、内存等指标的图表组件',
        status: 'active',
        createTime: '2024-01-05 09:00:00',
        updateTime: '2024-05-17 17:22:00',
        permissions: ['monitor:view'],
        metadata: {
            chartType: 'line',
            interval: '5min',
            dataSources: ['cpu', 'memory', 'disk'],
        },
    },
    {
        id: 'element-004',
        name: '消息通知弹窗',
        type: 'Popup',
        module: '通知中心',
        description: '用于显示系统消息的弹窗组件',
        status: 'active',
        createTime: '2024-02-14 12:30:00',
        updateTime: '2024-06-12 09:00:00',
        permissions: ['notify:view'],
        metadata: {
            animation: 'fade',
            duration: 5000,
            dismissible: true,
        },
    },
    {
        id: 'element-005',
        name: '文件上传控件',
        type: 'Upload',
        module: '资源管理',
        description: '支持多种格式的文件上传功能',
        status: 'inactive',
        createTime: '2024-04-03 10:00:00',
        updateTime: '2024-06-01 15:00:00',
        permissions: ['file:upload'],
        metadata: {
            maxSizeMB: 50,
            accept: ['.jpg', '.png', '.pdf'],
            dragDrop: true,
        },
    },
    {
        id: 'element-006',
        name: '操作日志表格',
        type: 'Table',
        module: '审计中心',
        description: '展示用户操作记录的表格控件',
        status: 'active',
        createTime: '2024-03-18 13:40:00',
        updateTime: '2024-07-22 16:10:00',
        permissions: ['audit:view'],
        metadata: {
            columns: ['user', 'action', 'timestamp'],
            pagination: true,
        },
    },
    {
        id: 'element-007',
        name: '快速入口按钮组',
        type: 'ButtonGroup',
        module: '首页',
        description: '提供常用功能的快速入口',
        status: 'active',
        createTime: '2024-05-01 08:00:00',
        updateTime: '2024-05-12 11:00:00',
        permissions: ['dashboard:access'],
        metadata: {
            layout: 'horizontal',
            buttons: ['新建', '导入', '设置'],
        },
    },
    {
        id: 'element-008',
        name: '权限配置界面',
        type: 'Form',
        module: '权限管理',
        description: '用于配置角色与权限的界面表单',
        status: 'inactive',
        createTime: '2024-02-28 09:30:00',
        updateTime: '2024-06-25 10:15:00',
        permissions: ['auth:edit'],
        metadata: {
            steps: ['基本信息', '权限分配', '确认提交'],
            editable: true,
        },
    },
    {
        id: 'element-009',
        name: '系统状态仪表盘',
        type: 'Dashboard',
        module: '监控中心',
        description: '展示实时系统运行状态的可视化仪表盘',
        status: 'active',
        createTime: '2024-01-18 10:45:00',
        updateTime: '2024-07-01 12:00:00',
        permissions: ['monitor:dashboard'],
        metadata: {
            widgets: ['CPU', 'Memory', 'Network'],
            refreshInterval: '30s',
        },
    },
    {
        id: 'element-010',
        name: '系统更新提示',
        type: 'Alert',
        module: '设置中心',
        description: '提醒用户系统已更新的消息提示组件',
        status: 'active',
        createTime: '2024-06-01 08:10:00',
        updateTime: '2024-07-15 09:20:00',
        permissions: ['system:update:notify'],
        metadata: {
            level: 'info',
            autoDismiss: true,
        },
    },
    {
        id: 'element-011',
        name: '帮助文档链接',
        type: 'Link',
        module: '帮助中心',
        description: '跳转到官方帮助中心的外部链接组件',
        status: 'inactive',
        createTime: '2024-03-03 11:11:00',
        updateTime: '2024-04-04 14:14:00',
        permissions: ['help:access'],
        metadata: {
            href: 'https://docs.example.com',
            target: '_blank',
        },
    },
    {
        id: 'element-012',
        name: '日报提交表单',
        type: 'Form',
        module: '项目管理',
        description: '填写并提交每日工作报告的表单',
        status: 'active',
        createTime: '2024-07-01 09:00:00',
        updateTime: '2024-07-31 17:00:00',
        permissions: ['report:submit'],
        metadata: {
            fields: ['title', 'content', 'date'],
            autosave: false,
        },
    },
    {
        id: 'element-013',
        name: '导出按钮',
        type: 'Button',
        module: '数据中心',
        description: '导出当前数据表的操作按钮',
        status: 'active',
        createTime: '2024-06-10 09:30:00',
        updateTime: '2024-07-05 10:00:00',
        permissions: ['data:export'],
        metadata: {
            format: ['csv', 'xlsx'],
            confirmBeforeDownload: true,
        },
    },
]

// 模拟分页或过滤
export function getDashboardItems({ page = 1, pageSize = 3 }) {
    const start = (page - 1) * pageSize
    return items.slice(start, start + pageSize)
}

//卡片详情
export function getItemById(id: string) {
    console.log(id, 'id');
    return items.find(item => item.id == id)
}

